package main

import (
	"os"
	"os/signal"
	"server/src/logging"
	"server/src/storage"
	"syscall"
)

const VER string = "pushclientd v1.0 build 240418"

func main() {

	var err error

	storage.Init(storage.RootPath())

	// 启动日志
	logging.DisableBootScreenLog()
	logging.LogBoot()

	zLog(VER, " 启动")

	//读取配置
	cfg, err := loadConfig("")
	if err != nil {
		zLogError(VER, " 启动 loadConfig error::", err.Error())
		return
	}

	//监听HTTP端口
	ListenHttpService(cfg)

	//监听信号
	signalChan := make(chan os.Signal, 1)
	signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)

	s := <-signalChan
	zLog("服务器收到退出信号:", s)

}
